home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / ada_met1.zip / PARSER.DOC < prev    next >
Text File  |  1980-01-04  |  5KB  |  89 lines

  1.  
  2.  
  3.                                    ADA_METRIC
  4.  
  5.  
  6.     ADA-METRIC is a library of Ada source code useful in building Ada software
  7. analysis tools. The core of the library, found in files PARSER_4, PARSER_3,
  8. PARSE_2B, PARSE_2A, PARSER_1 and PARSER_0, is a complete recursive descent
  9. parser (RDP) for the Ada language. Each part of the Ada language appears as an
  10. explicit procedure in the source code. For example, the following function
  11. parses the subtype indicator aspect of the ADA language:
  12.  
  13.  
  14.         -- SUBTYPE_INDICATION   ===>    NAME [CONSTRAINT ?]
  15.     
  16.         function SUBTYPE_INDICATION return boolean is
  17.         begin
  18.             if (NAME) then                         -- check for type-mark
  19.                 if (CONSTRAINT) then null; end if;
  20.                 return (TRUE);
  21.             else
  22.                 return (FALSE);
  23.             end if;
  24.         end SUBTYPE_INDICATION;
  25.  
  26.  
  27.      Recursive descent parsing is a top-down method of syntax analysis in
  28. which a set of recursive procedures processes the input source code. The
  29. token synbols recognized by the scanner unambigously determine the function
  30. selected for each nonterminal of the Ada language. ADA-METRIC assumes that
  31. the source code being analyzed is syntactically correct, that is, that it
  32. has been successfully compiler by an Ada compiler. Thus parser tasks such
  33. as type checking are not handled. However the parser can be easily modified
  34. to perform there tasks.
  35.  
  36.      With the grammar to the Ada language exposed, it becomes easy to develop
  37. software tools by augmenting those functions and procedures that parse the
  38. aspects of Ada for which the developed tool will be addressing. For example,
  39. code provided with ADA-METRIC includes statements to calculate Halstead's
  40. metric, which measures the quality of Ada programs. These statements, which
  41. basically count occurences of operators and operands, occur in those parts
  42. of the parser that parse for operators and operands.
  43.  
  44.      While recursive parsers are less efficient than the state table parsers
  45. generated by YACC, they have a few advantages. With the grammar explicitly
  46. laid out in the code, programmers can obtain a much better feel for the
  47. structure of the Ada language, as compared to the difficult to understand
  48. YACC state tables. Thus the program is self documenting, as good Ada codes
  49. should be.
  50.  
  51.      An excellent guide to the Ada language, including the grammar on which
  52. the parser is based, is found in the ANSI standard ANSI/MIL-STD-1815A-1983.
  53.  
  54.      Included with the source code for the parser are a few Ada packages that
  55. provide routines for estimating the cost of developing software. The cost
  56. estimation algorithm has 68 parameters, and is the result of research done by 
  57. NASA to develop formulas for estimating the cost of developing space systems
  58. software. The structure of the estimator is simple. First there is code to
  59. query the user for the values of the parameters. These values are then
  60. substituted into functions whose final results are the cost, time and line of
  61. code estimates for the project.
  62.  
  63.      Both the recursive descent parser and the cost estimator have very simple
  64. user interfaces, mostly to provide a feel on how the programs operate. The
  65. goal of the users of ADA-METRIC should be to embed the main algorithms in
  66. these packages into their own systems and user interfaces. Also, some of 
  67. the algorithms in ADA-METRIC are optimized to be easy to understand, rather
  68. than to be efficient in operation (such as the keyword lookup recognizer).
  69.  
  70.                                    PLATFORMS
  71.  
  72.      The source code on the diskettes provided with this package will
  73. compile and execute on most personal computers, workstations, minicomputers
  74. and mainframes, for compilers running under most operating systems,
  75. including MS-DOS, OS/2, Xenix, Unix, and VMS. There are no royalties on
  76. embedded use of these libraries.
  77.  
  78.      The source code library is available from STO for $450. Please specify
  79. your choice of media (floppy disk, electronic mail, cartridge tape).
  80.  
  81.      Our goal at Source Translation & Optimization is to transfer software
  82. technology into your applications by providing clear and simply coded
  83. algorithms. You are encouraged to optimize the Ada code to the conventions
  84. used in your programming environment.
  85.  
  86.     STO also publishes a directory of software available from the US
  87. government. The 1990 edition includes the titles to over 9000 programs for
  88. which source code is available. The 320 page directory costs $79.
  89.